home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: bfasula@ix.netcom.com(William T. Fasula Jr. )
- Newsgroups: comp.lang.c++
- Subject: Re: file descriptors and fstreams...
- Date: 9 Apr 1996 00:46:11 GMT
- Organization: Netcom
- Message-ID: <4kcc0j$29q@dfw-ixnews2.ix.netcom.com>
- References: <4k780i$dd5@beyond.escape.com>
- NNTP-Posting-Host: nhv-ct4-09.ix.netcom.com
- X-NETCOM-Date: Mon Apr 08 7:46:11 PM CDT 1996
-
- In <4k780i$dd5@beyond.escape.com> ward@escape.com (Christian Ward)
- writes:
- >
- >
- >Hi I'm a very beginner c++ programmer, although I've been doing C for
- a
- >while. I know there's a C function called fdopen which takes a file
- >descriptor and creates a stream for it so you can use fprintf, fscanf,
- >and all that other good stuff. Is there a similar function (or
- whatever)
- >that takes a file descriptor and does something to let you use << and
- >>
- >with it?
- >
- >Like I said I'm very new to C++ and I'm sorry that I don't have the
- >correct terminology for all this stuff.
- >
- >Justin
-
- You can use the ifstream and ofstream for file input and output.
- #include <fstream.h>
- void main()
- {
- ofstream ofile("test.dat");
- ofile << "Test data";
- }
-